package cn.jiyun.controller;

import cn.jiyun.config.UserProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @GetMapping("/hello")
    public Map<String,Object> hello(){
        Map<String,Object> map=new HashMap<>();
        map.put("username","张三");
        map.put("age",18);
        map.put("gender","男");
        return map;
    }

    @Autowired
    private UserProperties userProperties;

    @RequestMapping("/config2")
    public UserProperties config2(){
        return userProperties;
    }
}
